{include file="public/nheader" /}
<style>
    .exception {
        margin: 150px 0;
        text-align: center;
    }

    .exception .exception-img {
        margin: 15px 30px;
        display: inline-block;
        vertical-align: middle;
    }

    .exception .exception-text {
        margin: 15px 30px;
        display: inline-block;
        vertical-align: middle;
    }

    .exception:not(.exception-dark) .exception-content>h1,
    .exception-content>p {
        color: #515a6e;
    }

    .exception .exception-content>h1 {
        font-size: 72px;
        font-weight: 600;
        margin: 0 0 20px 0;
    }

    .exception .exception-content>p {
        font-size: 20px;
        margin: 0 0 25px 0;
        color: #808695;
    }
</style>
{if !empty($row)}
<div class="layui-fluid layui-bg-white">
    <div class="layui-form-item" style="width: 100%;overflow-x:scroll">
        <table class="layui-table layui-form">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>服务名称</th>
                    <th>图片</th>
                    <th>单价</th>
                    <th>件数</th>
                    <th>计总</th>
                    <th>计总折扣价</th>
                </tr>
            </thead>
            <tbody>
                {foreach $row.product as $v}
                <tr>
                    <td>{$v.id|default='0'}</td>
                    <td>{$v.title|default=''}</td>
                    <td><img style="height:50px" src="{$v.images}" lay-image-click=""></td>
                    <td>{$v.price|default=''}</td>
                    <td>{$v.number|default=''}{if $v.cnumber > 0}(券抵扣:-{$v.cnumber}){/if}</td>
                    <td>{:floor($v.number*$v.price*10000)/10000}</td>
                    <td>{:floor($v.number*$v.price*$row.dict*100)/10000}</td>

                </tr>
                {/foreach}
            </tbody>
        </table>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">订单ID:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {$row.id|default='0'}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所属代理:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {$row.agent_name.nickname|default=''}({$row.agent_name.accounts|default=''})
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">订单编号:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {$row.ordersn|default='0'}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">用户信息:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {$row.name|default='0'} {$row.mobile|default='0'}
        </div>
    </div>
    {if $row.orderid > 0}
    <div class="layui-form-item">
        <label class="layui-form-label">师傅信息:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {$row.ridername|default='0'} {$row.ridermobile|default='0'}
        </div>
    </div>
    {/if}
    <div class="layui-form-item">
        <label class="layui-form-label">联系地址:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {$row.province_text|default='0'}/{$row.city_text|default='0'}/{$row.area_text|default='0'}/{$row.street_text|default='0'}<br />{$row.posaddress|default='0'}/{$row.address|default='0'}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">用户备注:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {$row.info|default='无'}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">订单状态:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {$row.status_text|default='0'}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">付款方式:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {$row.payment_text|default=''}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">订单原价:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {$row.ptotal|default='0'}元
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">会员价:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            会员价{$row.dicttotal|default='0'}元  优惠券优惠:{$row.cmoney|default='0'}元
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">抵扣减免:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {$row.ccount|default='0'}元
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">用户最终支付:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {$row.total|default='0'}元
        </div>
    </div>
    {if $row.cmoneys > 0}
    <div class="layui-form-item">
        <label class="layui-form-label">抵扣券补贴:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {$row.cmoneys|default='0'}元
        </div>
    </div>
    {/if}
    <div class="layui-form-item">
        <label class="layui-form-label">总收益(含累计抵扣券金额):</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {$row.cmoneys + $row.total}元
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">代理发放抵扣券金额:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {$row.rzmoney|default='0'}元
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">提现最终到账(去除当前代理发放抵扣券金额):</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {$row.total + $row.cmoneys - $row.rzmoney}元
        </div>
    </div>
    {if !empty($row['images1'])}
    <div class="layui-form-item">
        <label class="layui-form-label">清洗前照片:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {foreach $row.images1 as $v}
            <img style="height:50px" src="{$v}" lay-image-click="">
            {/foreach}
        </div>
    </div>
    {/if}
    {if !empty($row['images2'])}
    <div class="layui-form-item">
        <label class="layui-form-label">清洗后照片:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            {foreach $row.images2 as $v}
            <img style="height:50px" src="{$v}" lay-image-click="">
            {/foreach}
        </div>
    </div>
    {/if}
    <div class="layui-form-item">
        <label class="layui-form-label">时间:</label>
        <div class="layui-form-label" style="text-align: left;color:#1E9FFF;width:auto">
            下单:{$row.created|default='无'}<br />
            预约:{$row.appointment|default='无'}<br />
            {if $row.status >= 2}付款:{$row.paytime|default='无'}<br />{/if}
            {if $row.status >= 3}接单:{$row.ordertime|default='无'}<br />{/if}
            {if $row.status == 5}取消:{$row.caceltime|default='无'}<br />{/if}
            {if $row.status == 4}完结:{$row.endtime|default='无'}{/if}
        </div>
    </div>
    <div style="height:100px;clear:both"></div>
    <div class="layui-row  layui-center " style="position:fixed;bottom:20px;background:#fff;width:100%;">
        {if $row.status == 1}
        <button class="layui-btn layui-btn-danger" data-url="/orders/order_status?id={$row.id|default='0'}&status=5"
            data-reload="self" data-confirm="" lay-ajax="">取消订单</button>
        {/if}
        {if $row.status == 2}
        <button class="layui-btn layui-btn-green" data-title="指派师傅" data-area="60%,40%" data-url="#adminforms"
            lay-open="">指派师傅</button>
        <button class="layui-btn layui-btn-normal" data-url="/orders/order_status?id={$row.id|default='0'}&status=4"
            data-confirm="" lay-ajax="" data-reload="self">完结</button>
        <button class="layui-btn layui-btn-danger" data-url="/orders/order_status?id={$row.id|default='0'}&status=5"
            data-reload="self" data-confirm="" lay-ajax="">取消订单</button>
        {/if}
        {if $row.status == 3}
        <button class="layui-btn layui-btn-green" data-title="更换师傅" data-area="60%,40%" data-url="#adminforms"
            lay-open="">更换师傅</button>
        <button class="layui-btn layui-btn-normal" data-url="/orders/order_status?id={$row.id|default='0'}&status=4"
            data-confirm="" lay-ajax="" data-reload="self">完结</button>
        <button class="layui-btn layui-btn-danger" data-url="/orders/order_status?id={$row.id|default='0'}&status=5"
            data-reload="self" data-confirm="" lay-ajax="">取消订单</button>
        {/if}
    </div>
</div>
{else}
<div class="exception">
    <div class="exception-text">
        <div class="exception-content">
            <p>抱歉，订单不存在</p>
        </div>
    </div>
</div>
{/if}
<script type="text/html" id="adminforms">
    <div class="layui-fluid layui-bg-white">
        <form class="layui-form layui-form-fixed" action="{:url('orders/order_status')}">
            <div class="layui-form-item">
            <label class="layui-form-label"><font color="red">* </font>师傅账号</label>
            <div class="layui-input-block">
                <input name="ridermobile" value="{$row.ridermobile|default=''}"  placeholder="请填写师傅账号" type="number" class="layui-input" lay-verify="required" />
                <input type="hidden" value="{$row['id']|default='0'}" name="id" />
                <input type="hidden" value="3" name="status" />
            </div>
        </div>
        <div class="layui-footer layui-form-item layui-center ">
            <button class="layui-btn" lay-filter="submitPage" lay-submit>提交</button>
            <button class="layui-btn layui-btn-primary" type="button" sa-event="closePageDialog" >取消</button>
        </div>
        </form>
    </div>
</script>
{include file="public/nfooter" /}